#pragma once

#include "core/defines.hpp"

#include "input.hpp"
#include "vulkan_app_base.hpp"

#include <vulkan/vulkan.h>
#include <GLFW/glfw3.h>
#include <vector>


namespace core::app {

    class WindowCallbacks;

    class Window {
        friend class WindowCallbacks;

    public:
        Window(u16 width, u16 height, const char *title);

        ~Window();

        void SetApp(VulkanApp *vulkanApp);

        int AppRun();

        void Quit(int code = 0);

        [[nodiscard]] GLFWwindow *WindowHandle() const;

        [[nodiscard]] const input::InputContext *GetInput() const;

    private:
        // initialize order
        static void InitGLFW();

        void InitWindow(u16 width, u16 height, const char *title);

        void DestroyWindow();

        static void TerminateGLFW();

    private:
        // data
        GLFWwindow         *mainWnd;
        int                 exec_code;
        input::InputContext m_input;

        // app
        VulkanApp *app;
    };

}  // namespace core::app
